<style >
/* 可以设置不同的进入和离开动画 */
/* 设置持续时间和动画函数 */
.slide-fade-enter-active {
  transition: all 1.5s ease;
}

.slide-fade-leave-active {
  transition: all 1.5s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}

.slide-fade-enter,
.slide-fade-leave-to

/* .slide-fade-leave-active for below version 2.1.8 */
  {
  transform: translateX(10px);
  opacity: 0;
}
</style>
<style lang="scss" >
@import '../styles/version1/home_index.scss';
</style>

<template>
  <el-container id="home"  class="home-container">

    <home-header @changeCollapse="changeCollapse"/>

    <el-container class="home-main" >
      <el-aside class="home-left" :style="{ width: sideBarWidth + 'px' }" >
        <transition name="slide-fade" >
            <el-menu
              class="home-left-menu  animated fadeInRight"
              :unique-opened="true"
              :collapse="!isCollapse"
              :default-active="homeLeftMenuDefaultActive"
              ref="homeLeftMenu"
              @select="menuSelect">
              <menu-item v-for="menu in menus"
                :key="menu.id" :item="menu"
                :index="menu.id"
                :isShowLeft="isCollapse"
              />
            </el-menu>
        </transition>
    </el-aside>

      <el-main class="home-main-container">
        <tags-view v-if="loadAll"  @loadHtml="loadHtml" :isCollapse="isCollapse" />
        <el-row  class="home-main-content"  :style="{maxHeight: winH - 120+ 'px',height: winH - 120+ 'px'}"  v-if="loadAll">
          <el-col :span="24">
            <transition name="fade" mode="out-in"  v-show="!cpIsHtml">
              <keep-alive >
                <router-view ref="routerView" v-if="isRouterAlive" :key="$route.fullPath"></router-view>
              </keep-alive>
            </transition>

            <!-- 内容主体区域 -->
            <div class="layui-body" id="LAY_app_body" v-show="cpIsHtml">
            </div>
          </el-col>
        </el-row>

        <el-row  class="home-main-content"  :style="{maxHeight: winH - 120+ 'px',height: winH - 120+ 'px'}" v-if="!loadAll"
                 v-loading="!loadAll"
                 :element-loading-text="cploadingText"
                 element-loading-spinner="spinner-user"
                 element-loading-background="rgba(0, 0, 0, 0)"
                 element-loading-custom-class="spinner-custom"
        >
        </el-row>
      </el-main>
    </el-container>

<!--    pdf预览窗口-->
    <customDrawer :autoHide="false" title="PDF文件预览" ref="customDrawerPdf" :hideConfirm="true" attach="body">
      <template #content>
        <pdf  :src="pdfUrl"/>
      </template>
    </customDrawer>

    <el-drawer title="导入数据"
               :append-to-body="true"
               :visible.sync = "dialogImport"
               :destroy-on-close="true"
               v-if="dialogImport"
               direction="rtl"
               class="label-close"
               size="50%">
      <FortenImport :param="dialogImportParam" @printFormClose="dialogImportClose"></FortenImport>
    </el-drawer>

    <el-drawer title="标签打印"
               :append-to-body="true"
               :visible.sync = "setBarcodeVisible"
               :destroy-on-close="true"
               v-if="drawerSnPrint"
               direction="rtl"
               @opened="barcodeOpened"
               class="label-close"
               size="60%">
      <inOrderBarcode ref="barcodeForm"
                      :propLineId="propLineId"
                      :propWorkOrderKey="propWorkOrderKey"
                      :propSnArr="propSnArr"
                      :propLineIdRequired="true"
                      @close-barcode="closeBarcode"
      />
    </el-drawer>

    <el-drawer :title="dialogMoreTitle"
               :append-to-body="true"
               :visible.sync = "dialogMoreForm"
               :destroy-on-close="true"
               v-if="dialogMoreForm"
               direction="rtl"
               class="label-close"
               size="80%">
      <!-- 数据视图-->
      <indexModel   v-if="dialogMoreType == 'dataview'" :propViewKey="dialogMoreTypeKey"  style="padding: 0px 11px"
                    :propShowClose="true" @closewin ="dialogMoreClose"
                    :propPreQueryWrapper="dialogMoreWrapper"
                    :propViewForm="dialogMoreViewForm"
                    :rowEditParam="dialogMoreRowEditParam"
      />

      <!--报表-->
      <Report v-if="dialogMoreType == 'report'" :propReportKey="dialogMoreTypeKey" style="padding: 0px 11px" :propShowClose="true" @close ="dialogMoreClose" :propQueryWrapper="dialogMoreWrapper"></Report>
    </el-drawer>


    <!--提示确认框 成功-->
    <customDialog ref="customAlertSuccess" theme="success"/>

    <!--提示确认框 失败-->
    <customDialog ref="customAlertFail" theme="danger"/>

    <!--提示确认框 包含取消按钮-->
    <customDialog ref="customDialogConfirm" theme="warning" cancelBtn="取消" :zIndex="5000"/>

    <!--全局通知-->
    <t-notification v-show="notificationHome.show" id="notificationHome" style="position: absolute;right: 20px;  bottom: 12px; z-index: 999999" ref="notificationHome" theme="info">
      <template #title>
        <div>{{notificationHome.title}} <!--<small>消息通知副标题</small>--></div>
        <small style="    font-size: 12px;line-height: 12px;" v-show="strings.isNotBlank(notificationHome.subTitle)" v-html="notificationHome.subTitle">{{notificationHome.subTitle}}</small>
      </template>
      <template #content>
        <div v-html="notificationHome.content"></div>
      </template>
      <template #footer v-show="notificationHome.btnShow">
        <div class="t-notification__detail">
          <t-button class="t-notification__detail-item" theme="primary" variant="text" @click="notificationHomeClick">
            {{notificationHome.btnText}}
          </t-button>
        </div>
      </template>
    </t-notification>

    <!--全局确认输入框，只有一个文本域输入-->
    <customDrawer :autoHide="false" :title="confirmInputForm.title" ref="confirmInputDrawer" :widthPx="500" :heightPx="250" @confirm="confirmInputConfirm">
      <template #content>
        <customForm :labelWidth="80" ref="confirmInputForm" :rules="confirmInputForm.rules"  :data="confirmInputForm" style="margin-top: 30px">
          <template #content>
            <customFormItem
              label="说明"
              name="remark"
              :parent="_self"
              :form="confirmInputForm"
              :type="constCommon.formItemType.textarea.name"
              :config="{minRows: 3, autosize: false, maxRows: 5}"
              fullWidth
              ref="confirmInputFormRemark"
            />
          </template>
        </customForm>
      </template>
    </customDrawer>

    <!--选择单位-单个-->
    <tableDrawer
      ref="tableDrawerUnit"
      loadForce
      refName="tableDrawerUnit"
      viewKey="pack_units_crud"
      :queryWrapper="selectWrapper.unit.queryWrapper"
      :propUserParam="selectWrapper.unit.propUserParam"
      title="请选择单位"
      :subtitle="selectWrapper.unit.subtitle"
      :widthPer="50"
      :heightPx="-1"
      :widthPx="-1"
    />

    <!--选择供应商-单个-->
    <tableDrawer
      ref="tableDrawerSp"
      loadForce
      refName="tableDrawerSp"
      viewKey="suppliers_select"
      :queryWrapper="selectWrapper.sp.queryWrapper"
      :propUserParam="selectWrapper.sp.propUserParam"
      title="请选择供应商"
      :subtitle="selectWrapper.sp.subtitle"
      :widthPer="50"
      :heightPx="-1"
      :widthPx="-1"
    />

    <!--选择仓库单个-->
    <tableDrawer
      ref="tableDrawerHospitalWarehouse"
      loadForce
      refName="tableDrawerHospitalWarehouse"
      viewKey="hospital_warehouses_crud"
      :queryWrapper="selectWrapper.hospitalWarehouse.queryWrapper"
      :propUserParam="selectWrapper.hospitalWarehouse.propUserParam"
      title="请选择仓库"
      :subtitle="selectWrapper.hospitalWarehouse.subtitle"
      :widthPer="50"
      :heightPx="-1"
      :widthPx="-1"
    />

    <!--选择商品多个-->
    <tableDrawer
      ref="tableDrawerHospitalMaterial"
      loadForce
      refName="tableDrawerHospitalMaterial"
      viewKey="hospital_material_crud"
      :queryWrapper="selectWrapper.hospitalMaterial.queryWrapper"
      :propUserParam="selectWrapper.hospitalMaterial.propUserParam"
      title="请选择商品"
      :subtitle="selectWrapper.hospitalMaterial.subtitle"
      :widthPer="80"
      :heightPx="-1"
      :widthPx="-1"
    />

    <!--操作日志-->
    <customDrawer title="操作日志" ref="customDrawerSyslog" hideConfirm>
      <template #content>
        <data-view
          ref="dataViewSyslog"
          propViewKey="sys_log_crud"
          :propIsTdesign="true"
          :propOnlyQueryAll="true"
          :propAutoFetchData="false"
          v-if="loadAll"
        />
      </template>
    </customDrawer>

    <!--标签打印-->
    <customDrawer
      :autoHide="false"
      :footer="false"
      title="标签打印"
      :zIndex="88888"
      ref="customDrawerPrintLabel"
      @hide="customDrawerPrintLabelHide"
      :widthPx="666" :heightPx="240">
      <template #content>
        <FortenPrintLabel ref="printLabelInst" :param="printLabelFormParam"></FortenPrintLabel>
      </template>
    </customDrawer>

    <!--表单打印-->
    <customDrawer
      :title="pdfview.title"
      :widthPer="80"
      :hideConfirm="true"
      :footer="false"
      ref="customDrawerPdfView">
      <template #content>
        <customSpace fullWidth style="margin: 5px 0px;">
          <template #content>
            <customButton  title="打印" theme="primary" size="medium" @click="$refs.pdfviewIframe.contentWindow.print()"/>
            <customButton  title="关闭" theme="default" size="medium" @click="$refs.customDrawerPdfView.hide()"/>
          </template>
        </customSpace>

        <customForm :data="pdfview"  ref="printForm">
          <template #content>
            <customFormItem label="纸张大小" name="pageSize" :parent="_self" :form="pdfview"
                            :type="constCommon.formItemType.selectStatic.name"
                            :config="{options: [{label:'A4(标准打印机)',value: 'A4'},{label:'A5(针式打印机)',value: 'A5'}]}"
            />

            <customFormItem label="纸张方向" name="direction" :parent="_self" :form="pdfview"
                          :type="constCommon.formItemType.selectStatic.name"
                          :config="{options: [{label:'横向',value: 'transverse'},{label:'纵向',value: 'longitudinal'}]}"
            />
            <customFormItem label="间距模式" name="spacingMode" :parent="_self" :form="pdfview"
                            :type="constCommon.formItemType.selectStatic.name"
                            :config="{options: [{label:'正常间距',value: 'normal'},{label:'无间距',value: 'no_spacing'}]}"
            />
            <customFormItem label="每页数量" name="perRowsOfGrid" :parent="_self" :form="pdfview" :type="constCommon.formItemType.inputNumber.name"/>
          </template>
        </customForm>
        <iframe ref="pdfviewIframe" :src="cpPdfviewSrc" style=" width: 100%;height: 85vh;margin-top: 5px"/>
      </template>
    </customDrawer>

    <!--选择商品多个-->
    <tableDrawer
      ref="tableDrawerUserListMore"
      loadForce
      refName="tableDrawerUserListMore"
      viewKey="sys_user_select"
      :queryWrapper="selectWrapper.userListMore.queryWrapper"
      :propUserParam="selectWrapper.userListMore.propUserParam"
      title="请选择用户"
      :subtitle="selectWrapper.userListMore.subtitle"
      :widthPer="50"
      :heightPx="-1"
      :widthPx="-1"
    />

    <!--    新增数据后并选择-->
    <customDrawer   :title="'新增' + selectCreateFormBusType"   ref="selectCreateFormWin" :footer="false" attach="body" placement="right" >
      <template #content>
        <!-- 明细界面按钮区域 -->
        <div  class="button-box-top">
          <customSpace>
            <template #content>
              <customButton  title="保存" theme="primary" size="medium" @click="createFormWinFun('save')"/>
              <customButton  title="关闭" theme="default" size="medium"  @click="createFormWinFun('close')"/>
            </template>
          </customSpace>
        </div>
        <component
          v-if="selectCreateForm!==null"
          :is="selectCreateForm"
          ref="selectCreateForm"
          :propParent="_self"
          :propStatus="'edit'"
          :propRules="selectCreateFormRules"
        />
      </template>
    </customDrawer>
  </el-container>
</template>
<script>

import menuItem from '@/components/MenuItem.vue'
import homeHeader from '@/views/HomeHeader.vue'
import TagsView from '@/views/TagsView.vue'
import FortenPrintForm from '@/components/common/FortenPrintForm.vue'
import FortenPrintLabel from '@/components/common/FortenPrintLabel.vue'
import FortenPrintReport from '@/components/common/FortenPrintReport.vue'
import FortenImport from '@/components/common/FortenImport.vue'
import Report from '@/components/report/Report.vue'
import indexModel from '@/views/frame/data-view/index-model.vue'
import utilVuex from '../util/utilVuex.js'
import utilSocket from '../util/utilSocket.js'
import treeOfficeDrawer from '@/components/custom/bus/treeOfficeDrawer.vue'
import parameters from "../util/parameters";
import pdf from 'vue-pdf'
import router from '@/router'
import FortenVxetableStatic from '@/components/common/FortenVxetableStatic.vue'


export default {
  provide() {
    return {
      reload: this.reload
    }
  },
  data() {
    return {
      isRouterAlive: true,
      dialogPrintForm: false,
      dialogPrintReportForm: false,
      dialogMoreForm: false,
      dialogImport: false,
      drawerSnPrint: false,
      dialogPDFForm: false,
      dialogTreeList: false,
      setBarcodeVisible: false,
      printFormParam: null,
      printLabelFormParam: null,
      printReportFormParam: null,
      dialogImportParam: null,
      isCollapse: true,
      tabActive: null,
      tabsOpened: [],
      propLineId: null,
      propWorkOrderKey: null,
      propSnArr: null,
      menus: [],
      sideBarWidth: 210,
      dialogPrintTitleAppend: '',
      routes: [
        {
        }
      ],

      //树列表属性
      dialogTreeListTitle: '请选择',
      propTreeProps: undefined,
      propQueryUrl: undefined,
      propFieldNodeId: undefined,
      propFieldLabel: undefined,
      propTreeShowCheckbox: undefined,
      propOnlyQuery: undefined,
      pdfUrl: null,
      dialogMoreType: null,
      dialogMoreTypeKey: null,
      dialogMoreTitle: null,
      dialogMoreWrapper: null,
      dialogMoreViewForm: null,
      dialogMoreRowEditParam: null,
      winH: window.innerHeight,
      menuSearch: '',

      // 消息提醒配置
      notificationHome: {
        show: false,
        btnShow: false,
        title: '系统通知',
        subTitle: '',
        content: '通知内容',
        btnText: '查看详情',
      },

      // 选框查询条件
      selectWrapper: {
        // 单位选择
        unit:{
          queryWrapper: null,
          propUserParam: null,
          subtitle: null,
        },
        // 供应商选择
        sp:{
          queryWrapper: {},
          propUserParam: null,
          subtitle: null,
        },
        // 仓库选择
        hospitalWarehouse:{
          queryWrapper: {},
          propUserParam: null,
          subtitle: null,
        },
        // 商品选择-多个
        hospitalMaterial:{
          queryWrapper: {},
          propUserParam: null,
          subtitle: null,
        },
        // 用户列表选择-多个
        userListMore:{
          queryWrapper: {},
          propUserParam: null,
          subtitle: null,
        }
      },
      loadAll: false,
      getTotal: 0,
      getAdd: 0,
      // 输入确认
      confirmInputForm: {
        title: '系统提示',
        comment: '',
        confirmFun: () => {},
        rules: {
          remark: [{ required: true, message: '请输入原因', trigger: 'blur' }],
        }
      },

      htmlAddr: '',

      // 标签打印窗口关闭后执行函数
      customDrawerPrintLabelHideFun: null,

      // PDF预览配置
      pdfview: {
        title: 'pdf预览',
        src: null,
        pageSize: 'A4',
        direction: 'transverse',
        spacingMode: 'normal',
        perRowsOfGrid: 20,
      },
      //当前激活菜单的 index
      homeLeftMenuDefaultActive: '',

      selectCreateForm: null,
      selectCreateFormRules: {},
      selectCreateFormSaveAction: null,
      selectCreateFormAfterSave: null,
      selectCreateFormBusType: '',
    }
  },
  computed: {
    viewsKeepAlive() {
      return true
    },
    cploadingText() {
      return `资源加载中,总计: ${this.getTotal},已加载: ${this.getAdd}`
    },
    cpIsHtml() {
      let htmlAddr = this.$route.meta &&
      this.$route.meta.htmlAddr ? this.$route.meta.htmlAddr : ''
      return htmlAddr.indexOf('.html') != -1
    },

    // pdf预览地址
    cpPdfviewSrc() {
      let pdfSrc = this.pdfview.src
      if (!pdfSrc) {
        return  null
      }
      if (pdfSrc.indexOf("?") != -1) {
        pdfSrc += '&'
      } else {
        pdfSrc += '?'
      }
      pdfSrc += "pageSize="+this.pdfview.pageSize+"&direction="+this.pdfview.direction+"&spacingMode="+this.pdfview.spacingMode+"&perRowsOfGrid="+this.pdfview.perRowsOfGrid
      pdfSrc += '&tms=' + Date.now()

      return pdfSrc
    }
  },
  created() {
  },
  beforeMount() {
    this.initData()
  },
  mounted() {
    history.pushState(null, null, document.URL)
    window.addEventListener('popstate',  () => {
      history.pushState(null, null, document.URL)
    })

    const that = this
    //窗口变化后
    window.onresize = () => {
      return (() => {
        that.winH = window.innerHeight
      })()
    }
  },
  methods: {
    // 获取菜单
    navMenu() {
      this.$ajax.get('/upms/menus/navMenu').then(res => {
        if (res.success) {
          this.menus = res.data        //可用菜单列表
        }
      })
    },
    reload() {
      this.isRouterAlive = false
      this.$nextTick(function () {
        this.isRouterAlive =  true
      })
    },

    //用户登录后进行初始化
    initData() {
      let userInfo = this.utils.getCurrentUser()
      let deptType = userInfo ? userInfo.deptType : null
      if (this.strings.isBlank(deptType)) {
        this.utilMessage.alertFail('用户信息缺失，请重新登录!', () => {
          this.$router.push('/login', () => {
            global.utils.toLogin()
          })
        })
        return
      }
      this.getTotal = utilVuex.getMapSize()
      this.navMenu()
      localStorage.setItem("spInfo", null)
      if (this.constCommon.deptType.supplier == deptType) {
        this.$ajax.get(`/base/suppliers/get_current_supplier`).then((response) => {
          if (response.code == 0) {
            localStorage.setItem("spInfo", JSON.stringify(response.data))
          }
        })
      }
      if (this.constCommon.deptType.hospital == deptType) {
        this.$ajax.get(`/base/hospitals/get_current_hospital`).then((response) => {
          if (response.code == 0) {
            localStorage.setItem("hpInfo", JSON.stringify(response.data))
          }
        })
      }

      utilVuex.syncAll(this, () => {
        this.loadAll = true
      })
    },
    //控制左边菜单显示与否
    changeCollapse() {
      if (this.isCollapse) { //当前为展开状态
        this.sideBarWidth =  64
      } else {
        this.sideBarWidth = 210
      }

      this.isCollapse = !this.isCollapse
      localStorage.setItem('userNavIsCollapse', this.isCollapse)
    },
    menuSelect(index, path) {
    },
    //关闭打印界面
    printFormClose() {
      this.dialogPrintForm = false
    },
    //关闭导入窗口
    dialogImportClose() {
      this.dialogImport = false
    },
    //关闭标签窗口
    closeBarcode() {
      this.setBarcodeVisible = false
      this.drawerSnPrint = false
    },
    //打开标签窗口后
    barcodeOpened() {
      this.$refs.barcodeForm.gridSearch()
    },
    //关闭打印界面
    dialogMoreClose() {
      this.dialogMoreForm = false

      if (window.dialogMoreCloseCall) {
        window.dialogMoreCloseCall()
      }
    },
    // 消息右下角按钮点击
    notificationHomeClick() {
      if (this.notificationHome.btnCall) {
        this.notificationHome.btnCall()
      }
      setTimeout(() => {
        this.notificationHome.show = false
      }, 2000)
    },
    // 输入确认框确认
    confirmInputConfirm() {
      if (this.confirmInputForm.confirmFun) {
        this.$refs.confirmInputForm.validate().then(result => {
          if (result === true) {
            this.$refs.confirmInputDrawer.hide()
            this.confirmInputForm.confirmFun(this.confirmInputForm.remark)
            this.confirmInputForm.remark = ''
          }
        })
      }
    },

    loadHtml(htmlAddr) {
      this.htmlAddr = htmlAddr
      let query = this.$route.query
      if (query) {
        htmlAddr = this.utils.appendToUrl(htmlAddr,query)
      }

      // if (layui.$('[src="' + htmlAddr +'"]').length > 0) {
      //   layui.$('iframe[name="frameRoot"]').hide()
      //   layui.$('[src="' + htmlAddr +'"]').show()
      //   return
      // }
      // layui.$('#LAY_app_body').append(`<div class="layadmin-tabsbody-item layui-show"><iframe name="frameRoot" src="${htmlAddr}" class="layadmin-iframe"></iframe></div>`)
    },
    // 标签打印窗口关闭后
    customDrawerPrintLabelHide() {
      if (this.customDrawerPrintLabelHideFun) {
        this.customDrawerPrintLabelHideFun()
      }
    },

    openSelectCreateForm(busType, viewKey, formPath,afterSave) {
      let  that = this
      // eslint-disable-next-line import/no-dynamic-require
      require([`@/views/${formPath}`], (target) => {
        that.selectCreateForm = target.default
      })
        .catch(() => {
          that.selectCreateForm = null
        })

      let viewObj = JSON.parse(JSON.stringify(global.utilVuex.getDataviewMap()[viewKey]))
      this.selectCreateFormRules = this.selectCreateFormParseRules(viewObj.rules)
      this.selectCreateFormSaveAction = viewObj.saveEntry
      this.selectCreateFormAfterSave = afterSave
      this.selectCreateFormBusType = busType
      if (this.$refs.selectCreateForm && this.$refs.selectCreateForm.form) {
        this.$refs.selectCreateForm.form = {}
      }
      this.$refs.selectCreateFormWin.show()

      this.$nextTick(() => {
        setTimeout(() => {
          if (this.$refs.selectCreateForm && this.$refs.selectCreateForm.focusFirst) {
            this.$refs.selectCreateForm.focusFirst()
          }
        }, 1500)
      })
    },
    selectCreateFormParseRules(rules) {
      const obj = {}
      Object.keys(rules).forEach((objKey) => {
        const tmp = []
        rules[objKey].forEach((item) => {
          try {
            if (item) {
              if (item.constructor !== String) {
                /**
                 * @Description：兼容tdesign，转换下规则，不然会报错
                 * @Author wyt
                 * @Date 2023-09-27
                 */
                if (item.pattern) {
                  item.pattern = new RegExp(item.pattern)
                }
                tmp.push(item)
              } else {
                tmp.push(JSON.parse(item))
              }
            }

          } catch(e) {
            console.error('解析规则失败，原因如下')
            console.error(e)
          }
        })
        obj[objKey] = tmp
      })
      return obj
    },
    createFormWinFun(funType) {
      switch (funType) {
        case 'save': {
          this.$refs.selectCreateForm.$refs.editForm.validate().then((result) => {
            if (result && result == true) {
              this.utilVue.loadShow(true)
              this.$ajax
                .post(this.selectCreateFormSaveAction, this.$refs.selectCreateForm.form)
                .then((resp) => {
                  this.utilVue.loadHide()
                  if (resp.code == 0) {
                    this.utilMessage.success(resp.msg)
                    if (this.selectCreateFormAfterSave) {
                      this.selectCreateFormAfterSave(resp.data)
                    }
                    this.$refs.selectCreateFormWin.hide()
                  }
                })
            }
          })
          break
        }
        case 'close': {
          this.$refs.selectCreateFormWin.hide()
          break
        }
      }
    }
  },
  watch: {
    //路由变化后刷新数据
    $route(to, from) {

      let htmlAddr = to.meta && to.meta.htmlAddr ? to.meta.htmlAddr : ''
      if (htmlAddr.indexOf('.html') == -1) {
        // layui.$('iframe[name="frameRoot"]').remove()
      } else {
      }
      setTimeout(() => {
        if (this.$refs.routerView && this.$refs.routerView.menuActiveCall) {
          this.$refs.routerView.menuActiveCall()
          return
        }

        if (this.$refs.routerView && this.$refs.routerView.name == 'report') { //单个报表
          // this.$refs.routerView.handleQueryClick()
        } else if (this.$refs.routerView && this.$refs.routerView.name == 'reportMore') { //多个报表
          // this.$refs.routerView.fetchDataCurr()
        } else if (this.$refs.routerView) {
          //类型为dataview，并且只有一个dataview的，则一般为列表
          if (
            !this.$refs.routerView.menuActiveCall
            &&this.$refs.routerView.$children
            && this.$refs.routerView.$children.length == 1
            && this.$refs.routerView.$children[0].name == 'dataview'
          ) {
            this.$refs.routerView.$children[0].fetchData()
          }
        }
      }, 1000)

      if (window.dataViewInstList != undefined && window.dataViewInstList.length > 0) {
        // 清除表格提示，快速切换菜单的时候，表格提示不会自动关闭掉
        window.dataViewInstList.forEach(item => {
          item.clostTooltip()
        })
      }

      this.utils.updateUserState('routeCurrent', this.$route.path)
      let toUrl = to.meta && to.meta.htmlAddr || null
      if (toUrl) {
        const findMenuList = this.utils.findTreeNode(
          this.menus,
          m => m.properties && m.properties.url == toUrl
        ) || []
        if (findMenuList.length > 0) {
          this.homeLeftMenuDefaultActive = findMenuList[0].id
        }
      }


    }
  },
  components: {
    FortenVxetableStatic,
    menuItem,
    homeHeader,
    TagsView,
    FortenPrintForm,
    FortenPrintLabel,
    FortenPrintReport,
    FortenImport,
    Report,
    indexModel,
    treeOfficeDrawer,
    pdf
  }
}
</script>



